/*
 * @Descripttion:
 * @version:
 * @Author: sueRimn
 * @Date: 2020-10-21 18:10:42
 * @LastEditors: sueRimn
 * @LastEditTime: 2020-11-14 16:59:03
 * 文档地址：http://lz.25002.cn/msmcenter_api/index.php
 */
import request from '@/utils/request'
import store from '@/store/index'
const base = require('../../env/index')

// 夹带k_token
function addK_Token(data) {
    var token = {
        k_token: store.getters.k_token
    }
    Object.assign(data, token)
    return data
}

/**
 * 获取问卷列表
 */
export function getGroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/infos',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 新增问卷列表
 */
export function addGroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/save',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 发布问卷
 */
export function toUseGroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/issue',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 删除问卷至回收站
 */
export function toRecycleBinFroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/delete/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 获取回收站问卷列表
 */
export function getRecycleBinGroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/softinfos',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 恢复回收站问卷列表
 */
export function recoverdelRecycleBinGroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/recoverdel/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 保存问题
 */
export function saveQuestionItem(data) {
    return request({
        url: base.question_url + '/api/v1/admin/question/save',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 获取问题,改题
 */
export function getEditQuestionInfos(data) {
    return request({
        url: base.question_url + '/api/v1/admin/groupqestion/getquestion',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 获取问题,改分
 */
export function getQuestionInfos(data) {
    return request({
        url: base.question_url + '/api/v1/admin/groupqestion/getgroupquestion',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 删除问题
 */
export function deleteQuestionInfos(data) {
    return request({
        url: base.question_url + '/api/v1/admin/question/delReve/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/**
 * 删除问题
 */
export function deleteQuestionOption(data) {
    return request({
        url: base.question_url + '/api/v1/admin/option/delete/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/** 问题组关联 */
export function addQuestionGroup(data) {
    return request({
        url: base.question_url + '/api/v1/admin/question/group/save',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

/** 获取问题和选项 */
export function getQuestionOption(data) {
    return request({
        url: base.question_url + '/api/v1/admin/question/group/getquestionoption',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
/** 设置不传状态 */
export function saveNoReport(data) {
    return request({
        url: base.question_url + '/api/v1/admin/group/noreport',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
